<extend name="Public/base" />
<block name="body">
        <form action="{:U('BuySend/insert')}" method="POST" id="form1" class="row" style="margin-left: 10px;margin-top:5px; ">
            <div class="row" style="line-height:50px;color:#FFF;background: #353535;width: 50%;">
                <span class="col-md-4">编号</span>
                <span class="col-md-4">满</span>
                <span class="col-md-4">送</span>
            </div>
            <div class="row text-center"  style="line-height: 40px;width: 50%;border:1px solid #000;">
                <volist name="activities" id="activity">
                        <span class="col-md-4">{$activity.id}</span>
                        <input class="col-md-4" type="number" value="{$activity.require}">
                        <input class="col-md-3" type="number" value="{$activity.send}">
                        <span class="col-md-1" style="border: 1px solid #30333F;font-weight: 700;">
                            <a href="{:U('BuySend/deleteById')}&id={$activity.id}" class="btn btn-default ajax-get confirm" style="background:#F0AD4E;color:#FFF;font-weight: 700;">删除</a>
                        </span>
                </volist>
            </div>
            <div class="row text-center" id="oldAct" style="line-height: 40px;width: 50%;border:1px solid #000;">

            </div>
            <div class="row " id="flag" style="margin-top:10px; ">
                <span class="col-md-1" >
                    <button type="button" id="addBuySend"  style="margin-left: 15px;" class=" btn btn-primary" >
                        添加满减+
                    </button>
                </span>
                <span class="col-md-2 " ></span>
                <span class="col-md-2 btn btn-primary" id="submitForm" >确认提交</span>
                <span class="col-md-2"></span>
                <span class="col-md-4"></span>
            </div>
        </form>
</block>
<block name="script">
    <script>
        $("#addBuySend").on("click", function(){
            $("#oldAct").append(
                    '<span  class="col-md-4" style="border: 1px solid #30333F;font-weight: 700;"></span>' +
                    '<input class="col-md-4" type="number" style="border:1px solid #428BCA;" name="require[]" >' +
                    '<input class="col-md-4" type="number" style="border:1px solid #428BCA;" name="send[]" >'
            )
        });
        $("#submitForm").click(function(){
            $("#form1").submit();
        });
        function deleteThis(id){
            id=String(id);
            goodsId.splice(goodsId.indexOf(id),1);
            $("#"+id).remove();
        };
    </script>
</block>
